#!/bin/bash

#This script installs and configures Wine/Proton for games to run on GNU/Linux

# WIC v0.3

echo Welcome to Wine configurator!
echo
echo Wine FAQ - https://wiki.winehq.org/FAQ
echo
read -p "Continue? (yes/no) > " text
 if [ "$text" = "no" ]; then
echo Cancelling...
exit
  else
echo
echo "Which OS is your distro based on?"
echo "(More info - https://en.wikipedia.org/wiki/List_of_Linux_distributions)"
echo
read -p "arch/debian > " text
 case $text in 
   arch ) sudo pacman -Syy
          sudo pacman -S wine winetricks lutris 
          echo now starts the gamemode part https://www.protondb.com/help/improving-performance
          echo setting up the gamemode tweaks and dxvk...
          yay -S gamemode dxvk-bin
        ;;
   debian ) echo installing Wine
            echo 
            sudo dpkg --add-architecture i386 
            wget -nc https://dl.winehq.org/wine-builds/winehq.key
            sudo apt-key add winehq.key
            sudo add-apt-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ hirsute main'
            sudo apt update
            sudo apt install winehq-stable
            echo
            echo installing winetricks...
            echo
            sudo apt install winetricks
            echo
            echo installing dxvk - Vulkan-based translation layer for Direct3D... 
            sudo apt install dxvk
            echo now starts the gamemode part https://www.protondb.com/help/improving-performance
            echo setting up the gamemode tweaks...
            sudo add-apt-repository ppa:samoilov-lex/gamemode
            sudo apt update
            sudo apt install gamemode
            echo Installing lutris... (https://lutris.net/)
            sudo apt install lutris
        ;;
   * ) echo "This distro for now is unsupported by this script" 
     exit 0
 esac
  fi
#This is the gamemode advice section.
 echo 
 echo
 echo
 echo ! ! !  Important Information ! ! ! 
 echo To use gamemode launching from Steam: enter gamemoderun %command% into the game’s launch options. 
 echo To use gamemode launching from Lutris: Select the “Enable feral gamemode” option under “System Options”
 echo More info: "https://www.protondb.com/help/improving-performance"
 sleep 1
 echo . . . . .
 sleep 1
 echo . . . . .
 sleep 1
 echo . . . . .
 sleep 1
# ending gamemode advice section.
echo installing vcrun6sp6 runtime libraries...
winetricks vcrun6sp6
echo
echo
echo installing runtime vcrun6 libraries...
echo
winetricks vcrun6
echo intalling d3dx9 runtime libraries ...
winetricks d3dx9
echo
echo installing corefronts...
winetricks corefronts
echo 
echo "Done."